<?php
/**
 * Created by PhpStorm.
 * User: R.Ice
 * Date: 2018/9/13
 * Time: 15:48
 * name:课程使用记录+学生表
 * url:/erpStudent/studentCourseRecordFixStudent
 */

if(isset($route->restfulParams['oscr_status'])){
    $oscr_status = "where oscr_status=".$route->restfulParams['oscr_status'];
}else{
    $oscr_status = "";
}

if($oscr_status==""){
    if(isset($route->restfulParams['os_oesid'])){
        $os_oesid = "where os_oesid=".$route->restfulParams['os_oesid'];
    }else{
        $os_oesid = "";
    }
}else{
    if(isset($route->restfulParams['os_oesid'])){
        $os_oesid = "and os_oesid=".$route->restfulParams['os_oesid'];
    }else{
        $os_oesid = "";
    }
}

if($os_oesid==""){
    if(isset($route->restfulParams['surplus_course'])){
        $surplus_course = "where oscr_surplus_class<=".$route->restfulParams['surplus_course'];
    }else{
        $surplus_course = "";
    }
}else{
    if(isset($route->restfulParams['surplus_course'])){
        $surplus_course = "and oscr_surplus_class<=".$route->restfulParams['surplus_course'];
    }else{
        $surplus_course = "";
    }
}

$sql = "select * from v_art_student_course_record_fix_student  $oscr_status  $os_oesid  $surplus_course group by oscr_osid;";

$re= $db->mysqlDB->query($sql);

$res = array( "data" => $re);

//返回成功结果
$response->responseData( true,$res);